home *** CD-ROM | disk | FTP | other *** search
/ Personal Computer World 2009 February / PCWFEB09.iso / Software / Linux / SLAX 6.0.8 / slax-6.0.8.iso / slax / base / 006-devel.lzm / usr / include / kautomount.h < prev    next >
Encoding:
C/C++ Source or Header  |  2005-10-10  |  3.7 KB  |  119 lines

  1. /* This file is part of the KDE libraries
  2.    Copyright (C) 2000 David Faure <faure@kde.org>
  3.  
  4.    This library is free software; you can redistribute it and/or
  5.    modify it under the terms of the GNU Library General Public
  6.    License version 2 as published by the Free Software Foundation.
  7.  
  8.    This library is distributed in the hope that it will be useful,
  9.    but WITHOUT ANY WARRANTY; without even the implied warranty of
  10.    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
  11.    Library General Public License for more details.
  12.  
  13.    You should have received a copy of the GNU Library General Public License
  14.    along with this library; see the file COPYING.LIB.  If not, write to
  15.    the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
  16.    Boston, MA 02110-1301, USA.
  17. */
  18.  
  19. #ifndef __auto_mount_h__
  20. #define __auto_mount_h__
  21.  
  22. #include <qobject.h>
  23. #include <qstring.h>
  24.  
  25. #include <kdelibs_export.h>
  26.  
  27. #ifdef Q_OS_UNIX
  28.  
  29. namespace KIO {
  30. class Job;
  31. }
  32.  
  33. /**
  34.  * This class implements synchronous mounting of devices,
  35.  * as well as showing a file-manager window after mounting a device, optionally.
  36.  * It is a wrapper around the asychronous KIO::special() call for mount,
  37.  * used by KMimeType.
  38.  *
  39.  * @short This class implements synchronous mounting of devices.
  40.  */
  41. class KIO_EXPORT KAutoMount : public QObject
  42. {
  43.   Q_OBJECT
  44.   friend class gcc_gives_a_warning_without_this;
  45. public:
  46.   /**
  47.    * Mounts a device.
  48.    * @param readonly if true, the device is mounted read-only
  49.    * @param format the file system (e.g. vfat, ext2...) [optional, fstab is used otherwise]
  50.    * @param device the path to the device (e.g. /dev/fd0)
  51.    * @param mountpoint the directory where to mount the device [optional, fstab is used otherwise]
  52.    * @param desktopFile the file the user clicked on - to notify KDirWatch of the fact that
  53.    * it should emit fileDirty for it (to have the icon change)
  54.    * @param show_filemanager_window if true, a file-manager window for that mountpoint is shown after
  55.    * the mount, if successful.
  56.    */
  57.   KAutoMount( bool readonly, const QString& format, const QString& device, const QString& mountpoint,
  58.               const QString & desktopFile, bool show_filemanager_window = true );
  59.  
  60. signals:
  61.   /** Emitted when the directory has been mounted */
  62.   void finished();
  63.   /** Emitted in case the directory could not been mounted */
  64.   void error();
  65.  
  66. protected slots:
  67.   void slotResult( KIO::Job * );
  68.  
  69. protected:
  70.   QString m_strDevice;
  71.   bool m_bShowFilemanagerWindow;
  72.   QString m_desktopFile;
  73. private:
  74.   /** KAutoMount deletes itself. Don't delete it manually. */
  75.   ~KAutoMount() {}
  76.   class KAutoMountPrivate* d;
  77. };
  78.  
  79. /**
  80.  * This class implements synchronous unmounting of devices,
  81.  * It is a wrapper around the asychronous KIO::special() call for unmount,
  82.  * used by KMimeType.
  83.  *
  84.  * @short This class implements synchronous unmounting of devices,
  85.  */
  86. class KIO_EXPORT KAutoUnmount : public QObject
  87. {
  88.   Q_OBJECT
  89.   friend class gcc_gives_a_warning_without_this;
  90. public:
  91.   /**
  92.    * Unmounts a device.
  93.    * @param mountpoint the mount point - KAutoUnmount finds the device from that
  94.    * @param desktopFile the file the user clicked on - to notify KDirWatch of the fact that
  95.    * it should emit fileDirty for it (to have the icon change)
  96.    */
  97.   KAutoUnmount( const QString & mountpoint, const QString & desktopFile );
  98.  
  99. signals:
  100.   /** Emitted when the directory has been unmounted */
  101.   void finished();
  102.   /** Emitted in case the directory could not been unmounted */
  103.   void error();
  104.  
  105. protected slots:
  106.   void slotResult( KIO::Job * );
  107. private:
  108.   QString m_desktopFile;
  109.   QString m_mountpoint;
  110. private:
  111.   /** KAutoUnmount deletes itself. Don't delete it manually. */
  112.   ~KAutoUnmount() {}
  113.   class KAutoUnmountPrivate* d;
  114. };
  115.  
  116. #endif //Q_OS_UNIX
  117.  
  118. #endif
  119.